import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
export default defineNuxtConfig({
  devtools: { enabled: false },
  app: {
    // 增加页面过度效果，这个name就是上面定义的名字：bounce 、 slide-fade 、 fade 、page、slide-left、slide-right
    //pageTransition: { name: 'page', mode: 'out-in' },
    head: {
      title: "学习512",
      charset: "utf-8",
      htmlAttrs: {
        lang: "zh-cn",
      },
      titleTemplate:"%s-好好学习，天天向上",
      "meta": [
        {
          "name": "viewport",
          "content": "width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
        },
        {
          "name": "keywords",
          "content": "学习512，Go，JAVA，前端，运维Devops，大数据"
        },
        {
          "name": "description",
          "content": "学习512是IT技能学习平台,致力于帮助有梦想的年轻人获取学习价值,课程涉及JAVA、前端、大数据等主流技术语言,提供有用、优质、完整内容的自学交流社区。"
        },
        {
          "charset": "utf-8"
        }
      ],
      link: [
        { rel: 'stylesheet', href: '/css/aliplayer.css' },
        { rel: 'stylesheet', href: '/css/animate.css' },
        { rel: 'stylesheet', href: '/fonts/iconfont.css' },
        { rel: 'stylesheet', href: '/editormd/css/editormd.css' }
      ],
      script: [
        {"src": "/js/jquery.min.js"},
        // {"src": "/js/debug.js"},
        {"src": "/editormd/editormd.min.js"},
        {"src": "/js/clipboard.js"},
        {"src": "/js/imgprview.js"}
      ]
    }
  },
  runtimeConfig:{
    ip: process.env.ip,
    SECRET_ID: process.env.SECRET_ID,
    SECRET_KEY: process.env.SECRET_KEY,
    MYHOME: process.env.MYHOME
  },
  css: [
    "@/assets/css/main.scss",
    "@/assets/css/skin.scss",
  ],
  modules: [
    'nuxt-windicss',
    ['@pinia/nuxt',{
      autoImports:['defineStore']
    }],
    '@pinia-plugin-persistedstate/nuxt',
  ],
  build: {
    transpile:
      process.env.NODE_ENV === 'production'
        ? [
            'naive-ui',
            'vueuc',
            '@css-render/vue3-ssr',
            '@juggle/resize-observer'
          ]
        : ['@juggle/resize-observer']
  },
  vite: {
    esbuild : {
      drop: process.env.NODE_ENV === 'production' ? ['console','debugger'] :[]
    },
    build :{
      minify: 'esbuild',
      chunkSizeWarningLimit: 1024,
      cssCodeSplit: true
    },
    plugins: [
      Components({
        resolvers: [NaiveUiResolver()],
      }),
    ],
    optimizeDeps: {
      include:
        process.env.NODE_ENV === 'development'
          ? ['naive-ui', 'vueuc', 'date-fns-tz/formatInTimeZone','@vicons/ionicons5']
          : []
    }
  },
  imports: {
    dirs: ["apis","utils"],
  },
  nitro: {
    // 缩小捆绑包
    minify: true,
    // 关闭源映射生成
    sourceMap: false,
  }
})
